package com.andy.nature.ui.activity

import androidx.recyclerview.widget.LinearLayoutManager
import com.andy.common.base.BaseVMActivity
import com.andy.image.ext.loadHttpUrl
import com.andy.nature.databinding.ActivityStickyEffectBinding
import com.andy.nature.ui.adapter.MessageAdapter
import com.andy.nature.vm.CommonViewModel

/**
 * Author:Andy
 * Date:2023/4/27 17:51
 * Description:StickyEffectActivity
 */
class StickyEffectActivity : BaseVMActivity<ActivityStickyEffectBinding, CommonViewModel>() {
    private val messageAdapter: MessageAdapter by lazy {
        MessageAdapter()
    }

    override fun viewModelClass(): Class<CommonViewModel> {
        return CommonViewModel::class.java
    }

    override fun getViewBinding(): ActivityStickyEffectBinding {
        return ActivityStickyEffectBinding.inflate(layoutInflater)
    }

    override fun initObserve() {
        mViewModel.testLiveData.observe(this) {
            messageAdapter.setData(it)
        }
    }

    override fun initData() {
        mBinding?.apply {
            ivImage.loadHttpUrl("https://wx2.sinaimg.cn/mw690/002Po4pSly1grt79wku06j61jk0rskjl02.jpg", 0)
            rvList.layoutManager = LinearLayoutManager(this@StickyEffectActivity)
            rvList.adapter = messageAdapter
        }
    }

    override fun initAction() {
        mBinding?.apply {

        }
    }

}